import WorldObject

class Thing(WorldObject.WorldObject):
	def __init__(self, name, description, location, world):
		super(Thing, self).__init__(world)
		self._location = location
		self._name = name
		self._description = description
		if self._location: self._location.objectEntered(self, None)
	
	@property
	def location(self): return self._location
	@property
	def name(self): return self._name
	@property
	def description(self): return self._description
	
	@property
	def isThing(self): return True
	
	def notify(self, message):
		if self.location: self.location.broadcast(message)
	
	def moveToLocation(location):
		old_location = self._location
		if old_location:
			old_location.objectLeft(self, location)	
		self._location = location
		location.objectEntered(self, old_location)
	
	